package com.patsnap.data.npd.dw.etl.job.ods.parser.journal;

import com.patsnap.data.npd.dw.etl.job.ods.dispatcher.DataProcessor;
import com.patsnap.data.npd.dw.etl.job.ods.dispatcher.OdsInfoLaunchProcessor;
import com.patsnap.data.npd.dw.etl.job.ods.serialization.PreOdsInfo;
import com.patsnap.data.npd.dw.repository.DBOperator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

public abstract class OdsJournalDataProcessor<T> extends DataProcessor<PreOdsInfo, T> implements OdsInfoLaunchProcessor {

    private static final Logger LOGGER = LoggerFactory.getLogger(OdsJournalDataProcessor.class);

    protected DBOperator operator;

    protected OdsJournalDataProcessor(Map<String, Object> globalConfig, DBOperator dbOperator) {
        super(globalConfig);
        operator = dbOperator;
    }

    @Override
    public String layerDependRelation() {
        return "JOURNAL -> ODS";
    }

    protected Integer longToInteger(Long oldLong) {
        return null == oldLong ? null : Math.toIntExact(oldLong);
    }
}
